CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
PROJECT("mesh_viewer")

SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR})

FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtOpenGL QtXml REQUIRED)
SET(CORELIBS ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${QT_QTXML_LIBRARY})
INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})

FIND_PACKAGE(GLUT)
FIND_PACKAGE(OpenGL)
FIND_PACKAGE(QGLViewer REQUIRED)
INCLUDE_DIRECTORIES(${QGLVIEWER_INCLUDE_DIR})
SET(CORELIBS ${CORELIBS} ${QGLVIEWER_LIBRARY} ${GLUT_LIBRARY} ${OPENGL_LIBRARY})

FIND_PACKAGE(OPENMESH)
INCLUDE_DIRECTORIES(${OPENMESH_INCLUDE_DIRS})
SET(CORELIBS ${CORELIBS} ${OPENMESH_LIBRARIES})

ADD_EXECUTABLE(mesh_viewer main.cpp viewer.cpp)
TARGET_LINK_LIBRARIES(mesh_viewer ${CORELIBS})
